home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / cmds / dviselect / num.h < prev    next >
Encoding:
C/C++ Source or Header  |  1989-06-16  |  1.1 KB  |  39 lines

  1. /*
  2.  * Copyright (c) 1987 University of Maryland Department of Computer Science.
  3.  * All rights reserved.  Permission to copy for any purpose is hereby granted
  4.  * so long as this copyright notice remains intact.
  5.  */
  6.  
  7. /*
  8.  * Pointer I/O: numbers.
  9.  *
  10.  * We deal in fixed format numbers and pointers here.
  11.  * For file I/O, see fio.h.
  12.  */
  13.  
  14. /*
  15.  * Get one unsigned byte.  Note that this is a proper expression.
  16.  * The rest have more limited contexts, and are therefore OddLy
  17.  * CapItaliseD.
  18.  */
  19. #define    pgetbyte(p)    UnSign8(*(p)++)
  20.  
  21. /*
  22.  * Get a two-byte unsigned integer, a three-byte unsigned integer,
  23.  * or a four-byte signed integer.
  24.  */
  25. #define    pGetWord(p, r) ((r)  = UnSign8(*(p)++) << 8, \
  26.             (r) |= UnSign8(*(p)++))
  27. #define    pGet3Byte(p,r) ((r)  = UnSign8(*(p)++) << 16, \
  28.             (r) |= UnSign8(*(p)++) << 8, \
  29.             (r) |= UnSign8(*(p)++))
  30. #define    pGetLong(p, r) ((r)  = UnSign8(*(p)++) << 24, \
  31.             (r) |= UnSign8(*(p)++) << 16, \
  32.             (r) |= UnSign8(*(p)++) << 8, \
  33.             (r) |= UnSign8(*(p)++))
  34.  
  35. /*
  36.  * ADD pputbyte, pPutWord, pPut3Byte, pPutLong HERE IF THEY PROVE
  37.  * USEFUL.  (But then must consider changing PutWord &c in fio.h.)
  38.  */
  39.